package com.ddl.eurekaclient.strategyMode;

public class Context {
	private Strategy strategy;

	/**
	 * @param type 策略类型
	 * @param money 价钱
	 * @param subMoney 满减价钱
	 * @param discount 折扣
	 */
	public Context(String type, Double money, Double subMoney, Double discount) {

		switch (type) {
			case "折扣":
				strategy = new IntermediateMemberStrategy(money, discount);
				break;
			case "满减":
				strategy = new AdvancedMemberStrategy(money, subMoney);
				break;
			default:
				strategy = new PrimaryMemberStrategy(money);
				break;
		}
	}

	public Double getResult() {
		return strategy.getResult();
	}
}
